from __future__ import annotations

from ..models.lead_ai_summary import LeadAISummary
from ..repositories.lead_ai_summary_repository import LeadAISummaryRepository
from ..repositories.lead_repository import LeadRepository
from ..schemas.lead_ai_summary import LeadAISummaryCreate


class AISummaryService:
    def __init__(
        self,
        ai_repo: LeadAISummaryRepository,
        lead_repo: LeadRepository,
    ) -> None:
        self.ai_repo = ai_repo
        self.lead_repo = lead_repo

    def create_summary(self, obj_in: LeadAISummaryCreate) -> LeadAISummary:
        return self.ai_repo.create(obj_in)

    def mark_reviewed(self, summary_id: int, reviewer_id: int) -> LeadAISummary | None:
        return self.ai_repo.mark_reviewed(summary_id, reviewer_id)

    def latest_for_lead(self, lead_id: int) -> LeadAISummary | None:
        return self.ai_repo.get_latest_by_lead(lead_id)
